package com.nuedu.corejava.ch13.homework;

public class HomeWork2 implements Runnable {
	private int beg;
	private int end;

	public HomeWork2(int beg, int end) {
		super();
		this.beg = beg;
		this.end = end;
	}

	@Override
	public void run() {
		boolean isPrime = false;
		for (int i = beg; i <= end; i++) {
			for (int j = 2; j < i; j++) {
				if ((i % j) == 0) {
					isPrime = false;
					break;
				}
			}
			if (isPrime) {
				System.out.print(i + "、");
			}
			isPrime = true;
		}
	}

	public static void main(String[] args) {
		HomeWork1 h1 = new HomeWork1(1, 1000);
		Thread thread1 = new Thread(h1);
		HomeWork1 h2 = new HomeWork1(1001, 2000);
		Thread thread2 = new Thread(h2);
		HomeWork1 h3 = new HomeWork1(2001, 3000);
		Thread thread3 = new Thread(h3);
		thread1.start();
		thread2.start();
		thread3.start();

	}

}
